<?php
namespace App\Validate;

use App\Validate\BaseValidate;
/**
 * 前言信息验证器
 */
class ForewordValidate extends BaseValidate {
    //验证规则
    protected $rule =[
        'id'=>'bail|required|integer',
        'name'=>'bail|required',
        'intro'=>'bail|required',
    ];
    //自定义验证信息
    protected $message = [
        'id.required'=>'前言编号不能为空',
        'id.integer'=>'前言编号格式不正确',
        'name.required'=>'前言名称不能为空',
        'intro.required'=>'前言简介不能为空',
    ];

    //自定义场景
    protected $scene = [
        'foreword_add' => ['name','intro'],//前言添加
        'foreword_change' => ['id','name','intro'],//前言修改
        'foreword_del' => ['id'],//前言删除
        'foreword_info' => ['id'],//前言详情
    ];




}